<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  	
    <title>产品列表</title>
    <base href="<%=basePath%>">
    
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <center>
    产品管理<br><br><br>
    <a href="commerce/Product_edit.action">添加产品</a><br><hr>
     <hr>
     <s:actionerror/>
     <s:actionmessage/>
    <table border="">
    	<tr>
    		<td>ID</td>
    		<td>产品名称</td>
    		<td>所属网店</td>
    		<td>所属分类</td>
    		<td>发布日期</td>
    		<td>是否可见</td>
    		<td>操作</td>
    	</tr>
    	<s:iterator value="productList" id="product">
    		<tr>
    			<td><s:property value="#product.id"/></td>
    			<td><s:property value="#product.productName"/></td>
    			<td><s:property value="#product.category.shop.shopName"/></td>
    			<td><s:property value="#product.category.categoryName"/></td>
    			<td><s:date name="#product.publishDate" format="yyyy-MM-dd"/></td>
    			<td><s:property value="#product.isVisiable"/></td>
    			
    			<s:url var="delete" value="commerce/Product_delete.action">
					<s:param name="productId" value="#product.id"></s:param>
				</s:url>
				<s:url var="editform" value="commerce/Product_edit.action">
					<s:param name="productId" value="#product.id"></s:param>
				</s:url>
				<s:url var="view" value="commerce/Product_view.action">
					<s:param name="productId" value="#product.id"></s:param>
				</s:url>
				<td>
				<s:a href="%{delete}">删除</s:a> &nbsp;&nbsp;
				<s:a href="%{editform}">修改</s:a> &nbsp;&nbsp;
				<s:a href="%{view}">详细信息</s:a>
    			</td>
    		</tr>
    	</s:iterator>
    </table><br><br>
    <div id="page">
    <a href="Product_list.action?pageModel.pageNo=${pageModel.topPageNo }">首页</a> &nbsp;&nbsp;
    <a href="Product_list.action?pageModel.pageNo=${pageModel.previousPageNo }">上一页</a>	&nbsp;&nbsp;
    <s:iterator value="#pageModel.showPages" id="showPageNo">
		<a href="Product_list.action?pageModel.pageNo=${showPageNo }">${showPageNo }</a> &nbsp;&nbsp;
    </s:iterator>
    <a href="Product_list.action?pageModel.pageNo=${pageModel.nextPageNo }">下一页</a> &nbsp;&nbsp;
    <a href="Product_list.action?pageModel.pageNo=${pageModel.bottomPageNo }">尾页</a> &nbsp;&nbsp;
    (${pageModel.pageNo }/${pageModel.totalPages })
    </div>
    </center>
  </body>
</html>
